package com.codeoss.framework.db.column;

import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;

import org.springframework.stereotype.Service;

import com.codeoss.framework.context.YunContext;
import com.codeoss.framework.data.metadata.Column;

@Service("bigdecimalColumnService")
public class BigDecimalColumnService implements IColumnService {

	@Override
	public Object getValue(YunContext yunContext, Column column, ResultSet rs) throws SQLException {
		// TODO Auto-generated method stub
		Object value=rs.getBigDecimal(column.getColumnName());
		if(rs.wasNull()){
			return null;
		}
		return value;
	}

	@Override
	public void setValue(YunContext yunContext, Column column, PreparedStatement ps, int index, Object value)
			throws SQLException {
		// TODO Auto-generated method stub
		ps.setObject(index, value);
	}

}
